# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=superd
pkgver=0.7.1
pkgrel=12
pkgdesc="lightweight user service supervising daemon"
url="https://sr.ht/~craftyguy/superd"
arch="all"
options="net"
license="GPL-3.0-or-later"
makedepends="go make scdoc"
subpackages="$pkgname-doc $pkgname-zsh-completion $pkgname-bash-completion"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~craftyguy/superd/archive/$pkgver.tar.gz
	superd.desktop
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	unset LDFLAGS # passed as go linker flags and invalid
	make PREFIX="/usr" VERSION="$pkgver"
}

check() {
	go test ./...
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir/superd.desktop" \
		-t "$pkgdir/usr/share/superd/"
}

sha512sums="
1a3e0d556013c7fa56c47ac49d57f57330c02b101f02a0a54110ca436a11eb17d6ea176ae6b83c981a553e85fd97c721e57d4356dc31c29f75e60837cf0a42cb  superd-0.7.1.tar.gz
ba69b7d850025ef3efc053362c341cdd66bc9aa772f1905ecc0371bebecd361132909250bfa078b5f3b7c814d351d4eac9ea05406c9e4c3dd7f60828045aa2cc  superd.desktop
"
